from django.contrib import admin
from .models import Survey


@admin.register(Survey)
class SurveyAdmin(admin.ModelAdmin):
    list_display = ['id', 'company_name', 'employee_count', 'security_risk', 'created_at']
    list_filter = ['created_at', 'updated_at', 'security_risk', 'deployment_mode']
    search_fields = ['company_name', 'main_business']
    readonly_fields = ['created_at', 'updated_at']
    
    fieldsets = (
        ('基本信息', {
            'fields': ('company_name', 'employee_count', 'main_business', 'security_risk', 
                      'security_risk_other', 'security_incident', 'security_incident_detail', 
                      'audit_expectation')
        }),
        ('组织管理', {
            'fields': ('security_policy', 'security_officer', 'security_officer_position')
        }),
        ('人员管理', {
            'fields': ('it_team_size', 'it_team_division', 'it_outsource', 'it_outsource_scope',
                      'security_staff', 'security_staff_name', 'confidentiality_agreement',
                      'account_revoke', 'security_training', 'security_training_freq')
        }),
        ('物理环境', {
            'fields': ('visitor_management', 'important_area_control', 'device_borrow')
        }),
        ('基础设施', {
            'fields': ('important_systems', 'deployment_mode', 'database_type', 'database_type_other',
                      'network_planning', 'remote_work', 'internet_exit_count', 'internet_bandwidth',
                      'data_backup')
        }),
        ('系统信息', {
            'fields': ('created_at', 'updated_at'),
            'classes': ('collapse',)
        }),
    )
